//
//  XMPersonInfoAvatarTableViewCell.m
//  XiaoMiao
//
//  Created by Jim huang on 2018/5/2.
//  Copyright © 2018年 smallyou. All rights reserved.
//

#import "XMPersonInfoAvatarTableViewCell.h"

@interface XMPersonInfoAvatarTableViewCell ()

//标题
@property (nonatomic,strong) UILabel * titleLabel;
//头像
@property (nonatomic,strong) UIImageView * avatarImageView;
@end

@implementation XMPersonInfoAvatarTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUI];
    }
    return self;
}


-(void)setUI{
    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    self.titleLabel = [[UILabel alloc]init];
    self.titleLabel.text = @"头像";
    self.titleLabel.textColor = kTextBlackColor;
    self.titleLabel.font = kFont(14);
    [self.contentView addSubview:self.titleLabel];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(20);
    }];
    
    self.avatarImageView = [[UIImageView alloc]init];
    [self.avatarImageView setImage:kDefaultPlaceholdeImage];
    self.avatarImageView.layer.cornerRadius = 4.0f;
    self.avatarImageView.layer.masksToBounds = YES;
    [self.contentView addSubview:self.avatarImageView];
    
    [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(-5);
        make.centerY.equalTo(self.contentView);
        make.width.height.equalTo(@70);
    }];
    
}


-(void)setImgUrl:(NSString *)imgUrl{
    _imgUrl = imgUrl;
    [self.avatarImageView sd_setImageWithURL:[NSURL URLWithString:imgUrl] placeholderImage:kDefaultPlaceholdeImage];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
